[POWERPC][XEN] Introduce "platform" abstraction to describe the IO hole.
authorHollis Blanchard <hollisb@us.ibm.com>
Fri, 2 Mar 2007 23:06:50 +0000 (17:06 -0600)
committerHollis Blanchard <hollisb@us.ibm.com>
Fri, 2 Mar 2007 23:06:50 +0000 (17:06 -0600)
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : %D12%89%D7%E6%1B3Y%EA%E9%D85IU%22%AD%29%AC%C1%B1

xen/arch/powerpc/Makefile
xen/arch/powerpc/mm.c
xen/arch/powerpc/papr/xlate.c
xen/arch/powerpc/platform.c [new file with mode: 0644]
xen/arch/powerpc/powerpc64/ppc970.c
xen/include/asm-powerpc/processor.h
xen/include/asm/platform.h [new file with mode: 0644]

index 669fce0e73de1a2a0394c3cb39acc1ff54bf70a2..f20580f6cecb805156868cd42a4c308afffb7ca4 100644 (file)
@@ -33,6 +33,7 @@ obj-y += of-devwalk.o
 obj-y += ofd_fixup.o
 obj-y += ofd_fixup_memory.o
 obj-y += physdev.o
+obj-y += platform.o
 obj-y += rtas.o
 obj-y += setup.o
 obj-y += shadow.o
index ae53469d904e7a067b8921d44bea58340b4cb546..2a8686c8908032bf40eede73c0ea55671164ab2a 100644 (file)
@@ -27,6 +27,7 @@
 #include <xen/perfc.h>
 #include <asm/init.h>
 #include <asm/page.h>
+#include <asm/platform.h>
 #include <asm/string.h>
 #include <public/arch-powerpc.h>
 
@@ -426,7 +427,7 @@ ulong pfn2mfn(struct domain *d, ulong pfn, int *type)
         /* Its a grant table access */
         t = PFN_TYPE_GNTTAB;
         mfn = gnttab_shared_mfn(d, d->grant_table, (pfn - max_page));
-    } else if (d->is_privileged && cpu_io_mfn(pfn)) {
+    } else if (d->is_privileged && platform_io_mfn(pfn)) {
         t = PFN_TYPE_IO;
         mfn = pfn;
     } else {
@@ -512,7 +513,7 @@ unsigned long mfn_to_gmfn(struct domain *d, unsigned long mfn)
         return max_page + (mfn - gnttab_mfn);
 
     /* IO? */
-    if (d->is_privileged && cpu_io_mfn(mfn))
+    if (d->is_privileged && platform_io_mfn(mfn))
         return mfn;
 
     rma_mfn = page_to_mfn(d->arch.rma_page);
index a476691f749ce2337adf3a9dcd4e2d95f00bac45..1d197dd0d4bd648dc006ef68629ed1ab3b6bcc88 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/current.h>
 #include <asm/papr.h>
 #include <asm/hcalls.h>
+#include <asm/platform.h>
 
 #ifdef DEBUG
 #define DBG(fmt...) printk(fmt)
@@ -536,7 +537,7 @@ long pte_remove(ulong flags, ulong ptex, ulong avpn, ulong *hi, ulong *lo)
 
     if (lpte.bits.v) {
         ulong mfn = lpte.bits.rpn;
-        if (!cpu_io_mfn(mfn)) {
+        if (!platform_io_mfn(mfn)) {
             struct page_info *pg = mfn_to_page(mfn);
             struct domain *f = page_get_owner(pg);
             
diff --git a/xen/arch/powerpc/platform.c b/xen/arch/powerpc/platform.c
new file mode 100644 (file)
index 0000000..459450e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Ryan Harper <ryanh@us.ibm.com>
+ *          Hollis Blanchard <hollisb@us.ibm.com>
+ */
+
+#include <asm/page.h>
+#include <asm/platform.h>
+
+#define IO_RANGE_START (2UL << 30)
+#define IO_RANGE_END   (4UL << 30)
+#define IO_SIZE        (IO_RANGE_END - IO_RANGE_START)
+
+unsigned long platform_iohole_base(void)
+{
+    return IO_RANGE_START;
+}
+
+unsigned long platform_iohole_size(void)
+{
+    return IO_SIZE;
+}
+
+int platform_io_mfn(unsigned long mfn)
+{
+    unsigned long maddr = mfn << PAGE_SHIFT;
+    return maddr > IO_RANGE_START && maddr < IO_RANGE_END;
+}
index 64a05571f6f92360348370a605503d2d2cfa8b25..415f8bbdce88a60db51657f8a92f0c92e1aa1caa 100644 (file)
@@ -129,18 +129,6 @@ unsigned int cpu_extent_order(void)
     return log_large_page_sizes[0] - PAGE_SHIFT;
 }
 
-/* This is more a platform thing than a CPU thing, but we only have
- * one platform now */
-int cpu_io_mfn(ulong mfn)
-{
-    /* totally cheating */
-    if (mfn >= (2UL << (30 - PAGE_SHIFT)) && /* 2GiB */
-        mfn < (4UL << (30 - PAGE_SHIFT)))    /* 4GiB */
-        return 1;
-
-    return 0;
-}
-
 int cpu_threads(int cpuid)
 {
     return 1;
index 3a4ad0426036ac9e61ba934429129d0a68daa658..fe43304e827b1f656dfe7622c558a22135c23d0a 100644 (file)
@@ -124,7 +124,6 @@ extern int cpu_rma_valid(unsigned int order);
 extern uint cpu_large_page_orders(uint *sizes, uint max);
 extern void cpu_initialize(int cpuid);
 extern void cpu_init_vcpu(struct vcpu *);
-extern int cpu_io_mfn(ulong mfn);
 extern int cpu_threads(int cpuid);
 extern void save_cpu_sprs(struct vcpu *);
 extern void load_cpu_sprs(struct vcpu *);
diff --git a/xen/include/asm/platform.h b/xen/include/asm/platform.h
new file mode 100644 (file)
index 0000000..74e810a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Ryan Harper <ryanh@us.ibm.com>
+ */
+
+#ifndef _ASM_PLATFORM_H_
+#define _ASM_PLATFORM_H_
+
+extern unsigned long platform_iohole_base(void);
+extern unsigned long platform_iohole_size(void);
+extern int platform_io_mfn(unsigned long mfn);
+
+#endif